﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Input;
using System.Diagnostics;

namespace Kokomo.PeInspector.Reflection
{
	class AssemblyExporterResultDetailViewModel : NotifierObject
	{
		public AssemblyExporterResultDetailViewModel(
			ImageSource iconSource,
			string itemText,
			ICommand itemCommand,
			object itemCommandParameter,
			string relativefileName,
			string fullfileName
			)
		{
			this.IconSource = iconSource;
			this.ItemText = itemText;
			this.ItemCommand = itemCommand;
			this.ItemCommandParameter = itemCommandParameter;

			if (!string.IsNullOrEmpty(relativefileName))
			{
				this.RelativeFileName = relativefileName;
				this.FullFileName = fullfileName;
				this.OpenFileCommand = new DelegatedCommand(this.OpenFile);
			}
		}

		public ImageSource IconSource { get; private set; }
		public string ItemText { get; private set; }
		public string OutputDirectory { get; private set; }
		public string RelativeFileName { get; private set; }
		public string FullFileName { get; private set; }
		public ICommand ItemCommand { get; private set; }
		public object ItemCommandParameter { get; private set; }

		public ICommand OpenFileCommand { get; private set; }
		private void OpenFile()
		{
			Process.Start("explorer.exe", string.Format("/select,{0}", this.FullFileName));
		}
	}
}
